<template>
<table>
    <tr>
        <td>用户名</td>
        <td><input v-model="info.name" type="text"/></td>
    </tr>
    <tr>
        <td>密码</td>
        <td><input v-model="info.pwd" type="password"></td>
    </tr>
    <tr>
        <td colspan="2"><input type="button" @click="logins"value="登录"></td>
    </tr>
</table>
</template>
<script setup lang="ts">
import { ref } from 'vue';

import axios from 'axios';

const info=ref({
    name:"",
    pwd:""
})
const logins=()=>{
axios({
    url:"https://localhost:44366/api/Drom/Locatons",
    params:{
        name:info.value.name,
        pwd:info.value.pwd
    },
    method:"get"
}).then(res=>{
    if(res.data.code==1){
        alert('用户名不存在')
        return
    }
    if(res.data.code==2){
        alert('密码错误')
        return
    }
    if(res.data==3){
        alert('登录成功')
    }
})
.catch(err=>{
        console.log(err);
    })
}
</script>